﻿@using NorthWind.Models
@model List<Order>
@{
    ViewBag.Title = "NextOrders";
}

@Html.ActionLink("Ajouter une commande", "Create", "Order")
@Html.ActionLink("Toutes les commandes", "AllOrdersSortedByDate", "Order")
@Html.ActionLink("Prochaines commandes", "NextOrders", "Order")
@Html.ActionLink("Vue par client", "ViewByClient", "Order")
@Html.ActionLink("Vue par employee", "ViewByEmployee", "Order")
@Html.ActionLink("Calendrier", "Index", "Calendar")
<br />

<h2>Prochaines commandes</h2>

@{
    
    if (Model.Count == 0)
    { 
    <span>aucune commandes pour cette semaine</span>
    }
    else
    {

    <table style="border: none; width: 1100px">

    <tr>
        <th>Numéro</th>
        <th>Client</th>
        <th>Employé</th>
        <th>Expéditeur</th>
        <th>Date de Commande</th>
    </tr>


    @foreach (Order order in Model)
    {
        <tr>
            <td class="center">@order.OrderID</td>
            <td>@Html.ActionLink(@order.Customer.CompanyName.ToString(), "Details", "Customer", new { id = order.CustomerID }, null)</td>
            <td>@Html.ActionLink(@order.Employee.FirstName + " " + @order.Employee.LastName, "Details", "Employee", new { id = order.EmployeeID }, null)</td>
            <td>@Html.ActionLink(@order.Shipper.CompanyName, "Details", "Shipper", new { id = order.ShipVia }, null)</td>
            <td class="center">@order.OrderDate.Value.ToShortDateString()</td>
            <td>@Html.ActionLink("Details", "Details", "Order", new { id = order.OrderID }, null)</td>
            <td>@Html.ActionImage("Edit", new {id = order.OrderID}, "~/Content/Images/edit.png", "Modifier")</td>
            <td>@Html.ActionImage("Delete", new {id = order.OrderID}, "~/Content/Images/delete.png", "Supprimer")</td>
        </tr>  
    }
</table>
    <br/>
        if (ViewBag.HasPreviousPage)
        {
            @Html.ActionImage("Index", new { page = (ViewBag.PageIndex - 1) }, "~/Content/Images/previous.png", "Précédent")
        }

        if (ViewBag.HasNextPage)
        {
            @Html.ActionImage("Index", new { page = (ViewBag.PageIndex + 1) }, "~/Content/Images/next.png", "Suivant")
        } 
    }
}